package com.ruoyi.framework.config.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
@ConfigurationProperties(prefix = "cross")
public class CorsConfig {

    private List<String> origins;

    public List<String> getOrigins() {
        // 添加默认值
        if (origins == null){
            origins= new ArrayList<>();
        }
        if (origins.isEmpty()){
            origins.add("*");
        }
        return origins;
    }

    public void setOrigins(List<String> origins) {
        this.origins = origins;
    }
}
